using System.Collections.Generic;

namespace Com.ContentRendering.Api.DataEngine.Handler.Self
{
    /// <summary/>
    internal class NullSelfHandler : AbstractSelfHandler
    {
        /// <summary/>
        internal NullSelfHandler(
            ReflectionCache reflectionCache,
            object value)
            : base(
            reflectionCache,
            value) { }

        /// <summary/>
        internal override IEnumerator<object> Parse()
        {
            // nothing to do if the value is not null
            if (this._value != null)
            {
                return base._successor.Parse();
            }

            List<object> parsedValues = new List<object>();

            // return the empty enumerator to indicate nothing was found
            return parsedValues.GetEnumerator();    
        }
    }
}
